﻿using System.IO;
using System;

namespace ShpMerger
{
    public class ExtendBinaryReader : BinaryReader
    {
        private int wordNumber; //the word byte length

        public ExtendBinaryReader(Stream theClass)
            : base(theClass)
        {
            wordNumber = 4;
        }

        public int ReadUsingBigEndian()
        {
            byte[] TempBytes = this.ReadBytes(wordNumber);
            Array.Reverse(TempBytes);
            return BitConverter.ToInt32(TempBytes, 0);
        }
        public int ReadInt32UsingBigEndian()
        {
            byte[] intBytes = this.ReadBytes(4);
            Array.Reverse(intBytes);
            return BitConverter.ToInt32(intBytes, 0);
        }
    }
}
